from flask import Blueprint, render_template

from settings import Setting
from util.EmailUtil import send_email

view_search = Blueprint('view_search', __name__)
view_search.url_prefix = '/view'


@view_search.route('/search')
def index():
    return render_template('public/style1/search.html')


@view_search.route('/send_email')
def send():
    user = Setting.email
    auth_code = Setting.auth_code
    sender = Setting.email
    subject = "这是一个测试"
    receivers = "xxx@qq.com"
    content = render_template('public/style1/search.html')
    return send_email(user, auth_code, sender, receivers, subject, content)


@view_search.route('/test')
def test1():
    return render_template('public/style1/test.html')
